home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
xvidoc.zip
/
SOURCE.MS
< prev
next >
Wrap
Text File
|
1992-07-28
|
44KB
|
1,414 lines
.\"========== Redefine NH to avoid widowing
.rn NH Nh
.nr nH 0
.de NH
.br
.if \\n(nH=\\$1 .sp 0.3i
.nr nH 1
.ne 1i
.Nh \\$1 \\$2
..
.\"========== Example macros
.de Ex
.br
.ne 0.75i
.IP "\fB\\$1\fP\ \ \ " \\$2
..
.de Ey
.sp -0.3v
.IP "\fB\\$1\fP\ \ \ " \\$2
..
.\"========== Put string in boldface & surround with quotes
.de qB
\%\*Q\fB\\$1\fP\*U\\$2
..
.\"========== 11 on 13 looks so much better than 10 on 12
.nr PS 11
.nr VS 13
.ps 11
.vs 13p
.nr PI 0.5i
.nr HM 0.9i
.nr FM 0.9i
.if n .nr PO 0.5i
.if n .nr LL 6.5i
.\"========== Turn hyphenation off, and make sure it stays off
.nh
.rm hy
.\"========== Headers in italics helps them to stand out from the text
.OH '\fIXvi Source Code Notes\fP''\fI%\fP'
.EH '\fI%\fP''\fIXvi Source Code Notes\fP'
.OF '\fI25th September 1992\fP''\fIPage %\fP'
.EF '\fIPage %\fP''\fI25th September 1992\fP'
.\"===========================================================================
.TL
Notes on the Xvi Source Code
.AU
Chris Downey
John Downey
.AB no
\fBXvi\fP (pronounced \fIecks-vee-eye\fP)
is a free, portable, multi-window implementation of the popular
.UX
editor \fBvi\fP.
.LP
This document contains information on how
to port \fBxvi\fP to systems not currently supported.
It also explains
how the \fBxvi\fP source code is arranged into modules,
and explains some of the data structures which are used,
so that modifications may be made if and when necessary
to the editor itself.
.AE
.\"===========================================================================
.NH 1
INTRODUCTION
.LP
\fBXvi\fP is intended to be portable to just about any system.
This is one of the central reasons for its existence; the
authors wish to be able to use the same editor everywhere.
.LP
The main body of the editor is (supposedly) fully portable,
relying only on standard facilities defined by the White
Book, and on a set of \fIprimitives\fP which are provided by a set
of one or more modules for each operating system.
If
.B __STDC__
is defined, certain ANSI C facilities will be used,
but the editor will compile with non-ANSI compilers.
.LP
Therefore, in order to port \fBxvi\fP to a new system, all that is
necessary is to provide the defined set of \fIprimitives\fP, and
then build the editor.
Or at least, that's the idea; we have refined the set of primitives
as we port the editor to new environments, and it's getting pretty easy now.
.LP
The rest of this document is divided into sections as follows:
.IP "\fISection 2: System-Specific Modules\fP"
This section deals with the layout of source files and makefiles
which you will have to deal with when porting \fBxvi\fP.
.IP "\fISection 3: Primitives Provided by xvi\fP"
Discusses what primitives are provided by the main body of the editor source
code for use by the system interface code.
.IP "\fISection 4: System Interface\fP"
Explains the primitives which need to be provided
in order to make \fBxvi\fP work.
.IP "\fISection 5: Data Structures\fP"
Details the internal data types used in the editor,
and any functions available for operating on those types.
.IP "\fISection 6: Source Files\fP"
Lists the source files comprising the editor,
and explains what functionality is provided by each one.
.\"===========================================================================
.NH 1
SYSTEM-SPECIFIC MODULES
.LP
The system-specific code normally consists of three (or more) files;
a
.qB .c
file, a
.qB .h
file, and a makefile.
For example:
.DS
.B
qnx.c
qnx.h
makefile.qnx
.R
.DE
comprise the system-specific module for the QNX operating system.
.LP
In most cases, the system-specific code is divided into two
or more modules, where one (called the \fIsystem interface module\fP)
is concerned with general interactions with the operating system
and the other (called the \fIterminal interface module\fP)
is designed for a specific interface to a display and keyboard
(and possibly, a mouse).
.LP
For example, the generic
.UX
implementation has
.B unix.c
and
.B unix.h
for the system interface module, and
.B termcap.c
and
.B termcap.h
for the terminal interface module; this should
work reasonably with any full-duplex terminal that can be
described in the
.B termcap
database.
On consoles with memory-mapped displays, or systems with graphic user
interfaces, however, it may be possible to achieve faster
display updating, and perhaps other benefits, by replacing
the
.B termcap
module with another one that makes better use of
whatever facilities are available.
For instance, there is an experimental version for SunView,
which allows mouse input on Sun workstations running the SunView window system.
.LP
On the other hand, the
.B termcap -specific
routines might
conceivably be useful on some other operating systems (such
as VMS), so in general it seemed a good idea to make the
.B termcap -specific
routines a separate module.
.LP
The current \%MS-DOS implementation has a separate terminal
interface module, which is designed specifically for IBM PC
compatible computers.
This is in the files
.DS
.B
ibmpc_a.asm
ibmpc_c.c
ibmpc.h
.R
.DE
The first of these is written in assembly language because
there are not enough routines common to the various \%MS-DOS
C compilers which reliably access the display and keyboard at
a low enough level.
.LP
The hardware-independent system interface module for \%MS-DOS is in
.DS
.B
msdos_a.asm
msdos_c.c
msdos.h
.R
.DE
The first of these is written in assembly
language for the same reason as is
.B ibmpc_a.asm .
.LP
Theoretically, different terminal interface modules could be
written for \%MS-DOS systems running on hardware which is not
IBM-compatible but, unfortunately, such systems seem to be
virtually extinct nowadays.
.LP
Sometimes more than one makefile is provided, as in the case of
.UX ,
where different versions work in slightly different ways.
.LP
It is, of couse, not necessary to provide all \(em or any \(em
of these files for a particular implementation; this is just a convention.
The makefile(s) for each system determine what
files are used in the compilation of the editor.
.LP
The following porting modules are available at present:
.\" ----------------------------------------------------------
.\" Note: this table does not fit very well with nroff output,
.\" so please try to avoid widening it if you add anything.
.TS
center, box;
c|c|c
l|l|l.
System Makefile Source Files
_
.sp 0.5v
UNIX
BSD \fBmakefile.bsd\fP \fBunix.[ch] termcap.[ch]\fP
System V \fB\(dg\fP \fBmakefile.usg\fP \fBunix.[ch] termcap.[ch]\fP
AIX \fBmakefile.aix\fP \fBunix.[ch] termcap.[ch]\fP
ULTRIX \fBmakefile.ult\fP \fBunix.[ch] termcap.[ch]\fP
Xenix \fB\(dg\fP \fBmakefile.xen\fP \fBunix.[ch] termcap.[ch]\fP
POSIX (e.g. BSDI) \fBmakefile.pos\fP \fBunix.[ch] termcap.[ch]\fP
SunOS \fBmakefile.sun\fP \fBunix.[ch] termcap.[ch]\fP
SunView \fBmakefile.sv\fP \fBunix.[ch] sunview.h\fP
\fBsunfront.c sunback.c\fP
\fBxvi.icn\fP
.sp 0.5v
_
.sp 0.5v
\%MS-DOS \fBmsdos_c.c msdos.h\fP
\fBibmpc_c.c ibmpc.h\fP
.sp 0.5v
Microsoft C 5.* \fBmakefile.msc\fP \fB8086mm.inc ibmpc_a.asm\fP
& MASM 5.* \fBmsdos_a.asm\fP
.sp 0.5v
Microsoft Quick C \fBmakefile.qc\fP \fB8086mm.inc ibmpc_a.asm\fP
& MASM 5.* \fBmsdos_a.asm\fP
.sp 0.5v
Zortech C++ 2.* \fBmakefile.zc2\fP \fB8086mm.inc ibmpc_a.asm\fP
& MASM 5.* \fBmsdos_a.asm\fP
.sp 0.5v
Zortech C++ 3.* \fBmakefile.zc3\fP \fB8086mm.inc ibmpc_a.asm\fP
& MASM 5.* \fBmsdos_a.asm\fP
.sp 0.5v
Zortech C++ 3.*
386 protected mode \fBmakefile.386\fP \fBpc386.[ch]\fP
.sp 0.5v
_
.sp 0.5v
OS/2 \fB\(dg\fP
Version 1, text mode
Microsoft C 5.1 \fBmakefile.os2\fP \fBos2vio.[ch]\fP
& MASM 5.1 \fBi286.asm\fP
.sp 0.5v
_
.sp 0.5v
QNX
Version 2/3 (CII) \fBmakefile.qnx\fP \fBqnx.[ch]\fP
Version 4 (Watcom C) \fBmakefile.qn4\fP \fBunix.[ch] termcap.[ch]\fP
.sp 0.5v
_
.sp 0.5v
TOS \fB\(dg\fP
Lattice C \fBmakefile.tos\fP \fBtos.[ch] tos.lnk\fP
.sp 0.5v
.TE
.IP \fB\(dg\fP 2
Versions marked with
.B \(dg
probably do not work, as systems
have not been recently available to the authors for testing.
.\"===========================================================================
.NH 1
PRIMITIVES PROVIDED BY XVI
.NH 2
General Definitions
.LP
The file
.B xvi.h
should be included by all sys